#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date    : 2016-11-06 21:30:05
# @Author  : guoben (guoben.ly@qq.com)
# @Link    : https://git.oschina.net/guoben

import cv2
import numpy as np


def draw_circle(event, x, y, flags, param):
    if event == cv2.EVENT_LBUTTONDBLCLK:
        cv2.circle(img, (x, y), 100, (255, 0, 0), -1)


if __name__ == "__main__":
    img = np.zeros((512, 512, 3), np.uint8)
    cv2.namedWindow('image')
    cv2.setMouseCallback('image', draw_circle)

    while(1):
        cv2.imshow('image', img)
        if cv2.waitKey(20) & 0xff == 27:
            break

    cv2.destroyAllWindows()
